//! \file filesystemstatus.hpp
//! \brief Purewell Library File System Status Header
//! \author Yubin Lim (purewell@gmail.com)
//! \since 2008-01-25

#ifndef __FILESYSTEMSTATUS_HPP__
#define __FILESYSTEMSTATUS_HPP__

#include "types.hpp"
#include "file.hpp"

namespace purewell
{

//! \brief File system status
class PWFileSystemStatus
{
public:
	//! \brief Get file system status.
	//! \param[in] file File.
	//! \return On success, true.
	bool getStatus(const PWFile& file);

	//! \brief Get file system status.
	//! \param[in] fd File descriptor.
	//! \return On success, true.
	bool getStatus(int fd);

	//! \brief Get file system status.
	//! \param[in] path Mount path.
	//! \return On success, true.
	bool getStatus(const char* path);

public:
	//! \brief Get block size.
	//! \return Block size.
	size_t	getBlockSize(void) const;

	//! \brief Get fragment size.
	//! \return Fragment size.
	size_t	getFragmentSize(void) const;

	//! \brief Get blocks.
	//! \return Block count.
	fsblkcnt_t	getBlocks(void) const;

	//! \brief Get free blocks.
	//! \return Free blocks.
	fsblkcnt_t	getFreeBlocks(void) const;

	//! \brief Get available blocks.
	//! \return Available blocks.
	fsblkcnt_t	getAvailableBlocks(void) const;

	//! \brief Get INODE count.
	//! \return INODE count.
	fsblkcnt_t	getINodes(void) const;

	//! \brief Get free INODE count.
	//! \return Free INODE count.
	fsblkcnt_t	getFreeINodes(void) const;

	//! \brief Get available INODE count.
	//! \return Available INODE count.
	fsblkcnt_t	getAvailableINodes(void) const;

	//! \brief Get file system ID.
	//! \return File system ID.
	size_t	getID(void) const;

	//! \brief Get mount flags.
	//! \return Mount flags.
	size_t	getFlags(void) const;

	//! \brief Get max file name size.
	//! \return Max file name size.
	size_t	getMaxFileNameSize(void) const;

	//! \brief Check read-only file system.
	//! \return When read=only file system, true.
	bool	isReadOnly(void) const;

	//! \brief Check SUID is ignored.
	//! \return When SUID is ignored, true.
	bool	isNoSUID(void) const;

public:
	explicit PWFileSystemStatus();

	//! \brief Copy constructor.
	//! \param[in] fs Source object.
	explicit PWFileSystemStatus(const PWFileSystemStatus& fs);

	//! \brief Constructor & get status.
	//! \param[in] path Mount path.
	explicit PWFileSystemStatus(const char* path);

	//! \brief Constructor & get status.
	//! \param[in] fd File descriptor.
	explicit PWFileSystemStatus(int fd);

	//! \brief Constructor & get status.
	//! \param[in] file File.
	explicit PWFileSystemStatus(const PWFile& file);
	virtual ~PWFileSystemStatus();

public:
	//! \brief Copy operator.
	//! \param[in] fs Source object.
	//! \return Reference of this object.
	PWFileSystemStatus& operator = (const PWFileSystemStatus& fs);

private:
	char m_pData[PWFSSTAT_MAX_LEN];	//!< Data object.
};

};//namespace purewell

#endif//!__FILESYSTEMSTATUS_HPP__

